selection: Add another surface api
authorMatthias Clasen <mclasen@redhat.com>
Mon, 23 Oct 2017 03:22:28 +0000 (05:22 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 23 Oct 2017 03:58:54 +0000 (05:58 +0200)
Of course, we need a getter too.

gtk/gtkselection.c
gtk/gtkselection.h

index 166e29fe8b19fda26c71378e54190e5dbf9e6be0..6590fac80e6d0def835c3c8c9b2d4285a5e874e0 100644 (file)
@@ -1750,6 +1750,19 @@ gtk_selection_data_set_surface (GtkSelectionData *selection_data,
   return retval;
 }
 
+cairo_surface_t *
+gtk_selection_data_get_surface (GtkSelectionData *selection_data)
+{
+  GdkPixbuf *pixbuf;
+  cairo_surface_t *surface;
+
+  pixbuf = gtk_selection_data_get_pixbuf (selection_data);
+  surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
+  g_object_unref (pixbuf);
+
+  return surface;
+}
+
 /**
  * gtk_selection_data_get_pixbuf:
  * @selection_data: a #GtkSelectionData
index e151571cf3c27b5158864660cdca3dfc1c8186e5..200272c0b1a3d5b489b2d0c089ffb360f8769302 100644 (file)
@@ -225,6 +225,8 @@ GDK_AVAILABLE_IN_ALL
 gboolean gtk_selection_data_set_pixbuf   (GtkSelectionData  *selection_data,
                                           GdkPixbuf         *pixbuf);
 GDK_AVAILABLE_IN_3_94
+cairo_surface_t *gtk_selection_data_get_surface (GtkSelectionData *selection_data);
+GDK_AVAILABLE_IN_3_94
 gboolean gtk_selection_data_set_surface (GtkSelectionData  *selection_data,
                                          cairo_surface_t   *surface);
 GDK_AVAILABLE_IN_ALL